The present invention relates to computer graphics, and more particularly to determining the level of detail (LOD) for texture mapping in computer graphics.
Textures are used in computer graphics to make computer images appear more realistic. A texture consists of a number of texture elements ("texels"). Each texel has a value corresponding to a color, intensity, or some other image parameter. The texture is mapped onto a whole or a portion of the image displayed by the computer. The mapping establishes a correspondence between pixels in the computer image and texels. Once the correspondence is established, the pixel color, intensity, or other parameters are modified by the texel values.
If the image onto which the texture is mapped is smaller than a texture, a pixel may correspond to more than one texel. This may happen, for example, when the computer displays an object moving away from the viewer. As the object moves away, it looks smaller. Therefore, the object's image on the screen is made smaller. Hence, the image includes fewer pixels. However, the texture size remains the same. Therefore, a pixel may correspond to a larger number of texels.
When a pixel corresponds to more than one texel, a filtering operation is performed. Filtering involves determining an average (perhaps a weighted average) of the texel values corresponding to the pixel. The averaged value is used to modify the pixel value.
To avoid performing the filtering in real time, it has been proposed to pre-filter the textures. See, for example, L. Williams, "Pyramidal Parametrics", Proceedings of SIGGRAPH '83, Computer Graphics, Vol. 17, no. 3, July 1983, pages 1-11. In that article, pre-filtered textures are called MIP maps. The MIP map of level 0 is the original texture itself. In the MIP map of level 1, each texel value is the average of respective four texel values from the MIP map of level 0; in the MIP map of level 2, each texel value is the average of respective four texel values from the MIP map of level 1; and so on. The MIP map level is called the "level of detail" (LOD). When the object is being displayed, the texel value which is to modify a pixel is taken from one of the MIP maps. Filtering in real time is not required.
It is desirable to provide fast and simple circuits and methods for determining the LOD so that the appropriate MIP map can be determined fast in real time.